package com.example.routeplansystem.entity.bo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.example.routeplansystem.entity.po.VehicleMessage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author 唐海军
 * @create 2022-05-11 7:56
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class VehicleExcelBO {
    @ExcelProperty("车辆ID")
    private Integer vehicleId;
    @ExcelProperty("车牌号")
    private String vehicleNumber;

    @ExcelProperty("车辆类型")
    private String type;
    @ExcelProperty("车辆容量")
    private float capacity;
    @ExcelProperty("车辆耗油量")
    private float oil;
    @ExcelProperty("车辆价格")
    private float price;
    @ExcelProperty("车辆生产日期")
    private Date date;
    
    public VehicleExcelBO(VehicleMessage vehicle){
        this.setVehicleId(vehicle.getVehicleId());
        this.setVehicleNumber(vehicle.getVehicleNumber());
        this.setCapacity(vehicle.getCapacity());
        this.setDate(vehicle.getDate());
        this.setOil(vehicle.getOil());
        this.setPrice(vehicle.getPrice());
        this.setType(vehicle.getType());
    }

    public VehicleMessage toPojo(int questionId){
        VehicleMessage vehiclePojo=new VehicleMessage();
        vehiclePojo.setQuestionId(questionId);
        vehiclePojo.setVehicleNumber(vehicleNumber);
        vehiclePojo.setVehicleId(vehicleId);
        vehiclePojo.setType(type);
        vehiclePojo.setCapacity(capacity);
        vehiclePojo.setOil(oil);
        vehiclePojo.setPrice(price);
        vehiclePojo.setDate(date);
        return vehiclePojo;
    }
}











